/*
 * @Author: wuhao930406 1148547900@qq.com
 * @Date: 2023-09-14 08:33:33
 * @LastEditors: wuhao930406 1148547900@qq.com
 * @LastEditTime: 2023-09-26 11:27:01
 * @FilePath: /utools_web/src/components/EditItems/index.jsx
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
import DragModal from '@/components/DragModal';
import { ItemAE } from '@/components/DragModal/formdoms';
import { EditFilled } from '@ant-design/icons';
import { Button, theme } from 'antd';
import { useState } from 'react';


function EditItems({ refresh, data }) {
  const { token } = theme.useToken();
  const { colorText, colorBgSecondary, colorPrimary, colorBgThird } = token;

  const [modal, setModal] = useState({
    title: '编辑',
    open: false,
  });

  return (
    <>
      <DragModal
        {...modal}
        width={848}
        onCancel={() => {
          setModal((s) => ({
            ...s,
            open: false,
          }));
        }}
      >
        <ItemAE
          defaultValue={data}
          refresh={async () => {
            await refresh();
            setModal((s) => ({
              ...s,
              open: false,
            }));
          }}
          stepId={data?.stepId}
          title={modal?.title}
        />
      </DragModal>
      <Button
        type='text'
        icon={<EditFilled style={{ color: "#4090FF", cursor: 'pointer',fontSize:15 }} />}
        onClick={() => {
          setModal((s) => ({
            ...s,
            open: true,
          }));
        }}
      />
    </>
  );
}

export default EditItems;
